home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-02-02 | 3.7 KB | 95 lines | [TEXT/GEOL] |
- Item 7235502 31-Jan-90 20:08PST
-
- From: D4453 Technically Soft, Chris Lang,PRT
-
- To: MADA2 MacApp Dev Assoc, Curtis Faith,IVC
-
- cc: MACAPP.TECH$ MacApp Technical
-
- Sub: OpenOld without the SFDlog
-
- Dear Curtis;
-
- After slaving over this thing for a couple of days now I'm no futher along.
-
- Basically I want to open a file right after my Application starts up. The
- default directory is in my case .Debug Files folder of myApp folder. I want to
- open Index-1 at 'Hard:MPW:WellPilot:.Debug Files:Empty Folder:Index-1'. I
- store all the information about Index-1 in a Rsrc of WellPilot (when its was
- originally saved or I can "Set Index" to update the stored info about the
- file). Ideally I would like to call openOld and pass it the info stored in
- those rsrc forks but I get OSerr -35 (no Volume by that reference ). I think
- the problem stems from the fact that "Empty Folder" is not a working directory
- and I can't seem to make it one. Here is the code for GetIndex. Its suppose
- to do just what OpenOld does. The only difference is that when MacApp calls
- openOld it first promts you for the working Directory via the SFDialog.
-
- Procedure TWellPilotApplication.GetIndex;
- VAR i, error : Integer;
- aStr : Str255;
- theBlk : HParamBlockRec;
- dataRefNum,rsrcRefNum : Integer;
- Pb : WDPBrec;
- begin
- With theBlk do begin
- ioCompletion:=nil;
- aStr:='Hard:MPW:WellPilot:.Debug Files:Empty Folder:Index-1';
- ioNamePtr:=@aStr;
- ioVRefNum:=-32621; { I know this is correct }
- ioFDirIndex:=0;
- ioDirID:=0;
- end;
- FailOSErr(PBHGetFInfo(@theBlk,false)); { Works wonderfully no error }
-
- with Pb do begin { same stuff as above }
- ioNameptr:=theBlk.ioNamePtr;
- ioVRefNum:=theBlk.ioVRefNum;
- ioWDIndex:=0;
- ioWDProcID:=0;
- ioWDVRefNum:=ioVRefNum
- end;
- error:=PBOpenWD(@Pb,false);
- If Error<>noErr then begin
- Writeln('error in PBOpenWD ',error); { error -120 }
- Pb.ioWDVRefNum:=6241; { this is correct WDDir }
- error := PBGetWDInfo(@Pb,false);
- If Error<>NoErr then begin
- Writeln('error in PBOpenWD ',error); { error -35 }
- ProgramBreak('Failed both times');
- end;
- end;
- error:=PBGetWDInfo(@Pb,false);
- If Error<>noErr then begin
- Writeln('error in PBGetWDInfo ',error); {error -35 of course }
- Pb.ioWDVRefNum:=6241;
- error := PBGetWDInfo(@Pb,false);
- If Error<>NoErr then begin
- Writeln('error in PBGetWDInfo ',error);
- ProgramBreak('Failed both times');
- end;
- end;
- error:=MAOpenFile(aStr,
- theBlk.ioVRefNum, { volRefNum }
- true, { opendata }
- false, { openrsrc }
- fsRdWrPerm, { exclusive read/write Permission 3 }
- fsRdWrPerm, { the rsrc fork also }
- dataRefNum, { returned }
- rsrcRefNum); { also returned }
- If error<>NoErr then
- ProgramBreak('ma open failed')
- else Writeln('OK so far');
- end;
-
- In a nut shell. Calling OpenWD with the info given above yields either error
- -35, volume not found, or -120, directory not found. I can't call PBGetWDInfo
- without first Opening the Working Directory. And of course MAOpenFile fails
- because PBGetWDInfo fails which is called within MAOpenFile. OpenOld calls
- OpenAFile which in turn calls MAOpenFile and the circle ends with error -35.
- Why can't I correctly call OpenWD??
-
- Thanks again
- Chris Lang @D4453
-
-
-